package kr.co.sdworld.webclient.spring.controller;

import kr.co.sdworld.api.apns.service.LoginService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class CT_Login 
{
	@Autowired
	private LoginService loginService;
	
	@RequestMapping("/login.sd")
	public ModelAndView login(@RequestParam(value="id")String id, @RequestParam(value="pw")String pw) 
	{
		ModelAndView mnv = new ModelAndView("jsonView");
		
		int result = loginService.login(id, pw);
		if( result == 1)
		{
			mnv.addObject("result", "success");
		}
		else
		{
			mnv.addObject("result", "fail");
		}
		
		return mnv;
	}
}
